﻿@using RiverCruise.Helpers
@model RiverCruise.Models.Company.CompaniesOverviewViewModel

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = "Companies";
}
<div class="container-fluid">
    
    <div class="pull-right">
        @using (Ajax.BeginForm(null, null, new AjaxOptions()
        {
            HttpMethod = "get",
            InsertionMode = InsertionMode.Replace,
            UpdateTargetId = "pagerTarget"
        },
            new { @class = "navbar-form" }))
        {
            <div class="input-group">
                <input type="text" class="form-control" placeholder="Search" name="searchText" id="searchText" data-otf-autocomplete="@Url.Action("AutoComplete", "Company")" data-autocomplete-submit="true">
                <div class="input-group-btn">
                    <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
                </div>
            </div>
        }
    </div>
    @if (Roles.IsUserInRole(RoleHelper.Edit))
    {
        <div class="pull-right">
            <a class="btn btn-success marginTop" href="@Url.Action("NewCompany", "CompanyManagement")"><span class="glyphicon glyphicon-plus-sign"></span> New Company</a>
        </div>
    }
    
    <span class="clearfix"></span>

    @if (Model.CompanyDeleted)
    {
        <div class="bs-callout bs-callout-warning text-warning">
            <ul><li>Company has been deleted.</li></ul>
        </div>
    }   
    
    <h2>Companies</h2>
    
    @Html.Partial("~/Views/Company/_Companies.cshtml", Model)

    

</div>